<%@ page contentType="text/html;charset=ISO8859_1" language="java" %>

<%@ taglib uri="/WEB-INF/tld/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tld/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tld/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tld/struts-nested.tld" prefix="nested" %>

<jsp:useBean id="oLogon" class="git.bankview.wl.bean.LogonBean" scope="session" />
<!-- jsp:useBean id="context" type="laya.semi.process.IProcessContext" scope="request" / -->
<jsp:useBean id="oNavigate" class="git.bankview.wl.bean.TransNavigateBean" />
<jsp:setProperty name="oNavigate" property="transid" value="90060" />

<html:html locale="true">
<head>
	<title><logic:iterate id="element" name="oNavigate" property="navigateList"
	><bean:write name="element" property="translabel" />
	 - </logic:iterate><bean:message key="report.NewReportTrans.title" /></title>
	<!-- title><bean:message key="report.NewReportTrans.title" /></title -->
	<link rel="stylesheet" href="../style/default_aux.css">
	<link rel="stylesheet" href="../style/pp.css">
</head>
<body onload="oninit();">
	<script src="../script/overlib.js" language="JavaScript"></script>
	<script src="../script/style.js" language="JavaScript"></script>
	<script src="../script/windows.js" language="JavaScript"></script>
	<table cellspacing="0" class="filledframe">
		<tr>
			<td nowrap="" class="clientframe">
				<table id="oHelp" class="helper" >
					<tr>
						<td width="200" class="label">&nbsp;</td>
						<td class="help"><input type="button" class="button" title="<bean:message key="common.help.title" />" onclick="help('help.console.task');" value="<bean:message key="common.help" />" ></td>
					</tr>
				</table>
				<html:form action="/console/NewTask" styleId="oNewForm" onsubmit="return onSubmitCheck()">
					<input type="hidden" name="pageUrl" value="<html:rewrite action="/console/TaskMonitor" />" />
					<div class="listtitle"><logic:iterate id="element" name="oNavigate" property="navigateList"
						><logic:empty name="element" property="pageurl"><bean:write name="element" property="translabel" /></logic:empty
						><logic:notEmpty name="element" property="pageurl"><a href="<bean:write name="element" property="pageurl" />" title="<bean:write name="element" property="transid" />"><bean:write name="element" property="translabel" /></a></logic:notEmpty
						><img src="../images/navconn.gif" ></logic:iterate><bean:message key="report.NewReportTrans.title" 
						/></div>
					<div class="subtitle"><bean:message key="taskschedule.newTask.step1" />
						<br><html:errors /></div>
					<table id="oPropPagesTab">
						<tr><td style="padding: 50px;"><h5><bean:message key="taskschedule.pp.wait" /></h5></td></tr></table>
					<!---------------- generial information properties page BEGIN ----------------->
					<div id="ppGeneral">
						<table width="100%" height="100%" cellspacing="0" class="formpanel">
							<tr><td class="toppad">&nbsp;</td></tr>
							<tr><td class="input"><table cellspacing="0"><tr>
								<td nowrap class="label"><bean:message key="taskschedule.taskid" />:</td>
								<td nowrap ><input name="taskid" size="5" maxlength="5" class="text" onkeydown="return focusMove()" onfocus="onFieldFocus()" onblur="onFieldBlur()" tabindex="102"> <html:errors property="needTaskid" /></td>
							</tr></table></td></tr>
							<tr><td class="input"><table cellspacing="0"><tr>
								<td nowrap class="label"><bean:message key="taskschedule.taskdesc" />:</td>
								<td nowrap ><input name="taskdesc" size="32" maxlength="32" class="text" onkeydown="return focusMove()" onfocus="onFieldFocus()" onblur="onFieldBlur()" tabindex="105"> <html:errors property="needTaskdesc" /></td>
							</tr></table></td></tr>
							<tr><td class="input"><table cellspacing="0"><tr>
								<td nowrap class="label"><bean:message key="taskschedule.type" />:</td>
								<td nowrap >
									<select id="oTaskClass" onchange="onTaskClassChange(this)">
										<option value="git.etl.AutoMultiTableTransporter"><bean:message key="git.etl.AutoMultiTableTransporter.name" /></option>
										<option value="git.bankview.bl.pump.SimpleSqlBatch"><bean:message key="git.bankview.bl.pump.SimpleSqlBatch.name" /></option>
										<option value="git.bankview.sl.schedule.NullTask"><bean:message key="git.bankview.sl.schedule.NullTask.name" /></option>
									</select>
								</td>
							</tr></table></td></tr>
							<tr><td class="input" id="oTaskClassDesc"></td></tr>
							<tr><td class="bottompad">&nbsp;</td></tr>
						</table>
					</div>
					<!---------------- generial information properties page END ----------------->
					
					<!---------------- parameters page BEGIN ----------------->
					<div id="ppParams">
						<table width="100%" height="100%" cellspacing="0" class="formpanel">
							<tr><td class="toppad">&nbsp;</td></tr>
							<tr><td class="input"><table cellspacing="0"><tr>
								<td nowrap class="label"><bean:message key="taskschedule.execurl" />/<bean:message key="report.prop.schdDateFmt" />:</td>
								<td nowrap >
									<select name="oSchdTempList" tabindex="211" >
										<option value="0"><bean:message key="dqreportschd.schdtype.d0" /></option>
										<option value="1"><bean:message key="dqreportschd.schdtype.d1" /></option>
										<option value="5"><bean:message key="dqreportschd.schdtype.d5" /></option>
										<option value="7"><bean:message key="dqreportschd.schdtype.d7" /></option>
										<option value="10"><bean:message key="dqreportschd.schdtype.d10" /></option>
										<option value="15"><bean:message key="dqreportschd.schdtype.d15" /></option>
										<option value="30"><bean:message key="dqreportschd.schdtype.d30" /></option>
										<option value="90"><bean:message key="dqreportschd.schdtype.d90" /></option>
										<option value="180"><bean:message key="dqreportschd.schdtype.d180" /></option>
										<option value="360"><bean:message key="dqreportschd.schdtype.d360" /></option>
									</select><br>
								</td>
								<td nowrap>&nbsp;/&nbsp;</td>
								<td nowrap>
									<input name="oSchdTemp" tabindex="212" type="text" class="text" size="12" maxlength="10" title="<bean:message key="common.aboutDateFormat" />" onkeydown="return focusMove()" onfocus="onFieldFocus()" onblur="return onDateFieldBlur()">
								</td><td width="61"><img src="/images/spacer.gif"></td><td nowrap>
									<input type="button" tabindex="215" class="button" value="<bean:message key="common.add" />" onclick="onAddSchdTemp()">
									<input type="button" tabindex="216" class="button" value="<bean:message key="common.delete" />" onclick="deleteSelectedRow(oTempList)">
									</td>
							</tr></table></td></tr>
						</table>
					</div>
					<!---------------- parameters page END ----------------->

					<!---------------- task URL page BEGIN ----------------->
					<div id="ppUrl">
						<table width="100%" height="100%" cellspacing="0" class="formpanel">
							<tr><td class="toppad">&nbsp;</td></tr>
							<tr><td class="input"><table cellspacing="0"><tr>
								<td nowrap class="label"><bean:message key="taskschedule.execurl" /></td>
								<td nowrap rowspan="2"><textarea name="execurl" cols="45" rows="12" tabindex="601"
								></textarea>
								<html:errors property="needExecurl" /></td>
							</tr><tr><td>&nbsp;</td></tr></table></td></tr>
							<tr><td class="bottompad">&nbsp;</td></tr>
						</table>
					</div>
					<!---------------- task URL page END ----------------->

					<!---------------- depends page BEGIN ----------------->
					<div id="ppDepends">
						<table width="100%" height="100%" cellspacing="0" class="formpanel">
							<tr><td class="toppad">&nbsp;</td></tr>
							<tr><td class="input"><table cellspacing="0"><tr>
								<td nowrap class="label"><bean:message key="dqreportschd.dependTrans" />:</td>
								<td nowrap ><input type="text" readonly="true" size="5" maxlength="5" class="text" id="oDependTrans" onkeydown="return focusMove()" onfocus="onFieldFocus()" onblur="onFieldBlur()" tabindex="271" onchange="onDependenceChange(this.value);" /> <html:errors property="needDependTrans" /></td>
									<td width="5"><img src="/images/spacer.gif"></td><td><input type="button" class="btedit" onclick="openNavigator('<html:rewrite action="/report/ReportNavigator" />', 'oDependTrans', 222, 420, '_blank', 'parent=00000')"></td>
								<td nowrap class="remark" id="oDependenceTranslabel" width="155">&nbsp;</td>
								<td nowrap>
									<input type="button" tabindex="275" class="button" value="<bean:message key="common.add" />" onclick="onAddDependTrans()">
									<input type="button" tabindex="276" class="button" value="<bean:message key="common.delete" />" onclick="deleteSelectedRow(oDependTransList)">
									</td>
							</tr></table></td></tr>
							<tr><td class="input"><table cellspacing="0"><tr>
								<td nowrap class="label">&nbsp;</td>
								<td nowrap width="300">
									<div id="oDependTransList"></div>
								</td>
							</tr></table></td></tr>
							<tr><td class="line"><hr></td></tr>
							<tr><td class="input"><table cellspacing="0"><tr>
								<td nowrap class="label"><bean:message key="dqreportschd.dependTable" />:</td>
								<td nowrap ><input type="text" size="20" maxlength="16" class="text" id="oDependTable" onkeydown="return focusMove()" onfocus="onFieldFocus()" onblur="onFieldBlur()" tabindex="281" /> <html:errors property="needDependTable" /></td>
								<td width="81"><img src="/images/spacer.gif"></td>
								<td nowrap>
									<input type="button" tabindex="285" class="button" value="<bean:message key="common.add" />" onclick="onAddDependTable()">
									<input type="button" tabindex="286" class="button" value="<bean:message key="common.delete" />" onclick="deleteSelectedRow(oDependTableList)">
									</td>
							</tr></table></td></tr>
							<tr><td class="input"><table cellspacing="0"><tr>
								<td nowrap class="label">&nbsp;</td>
								<td nowrap width="300">
									<div id="oDependTableList"></div>
								</td>
							</tr></table></td></tr>
							<tr><td class="bottompad">&nbsp;</td></tr>
						</table>
					</div>
					<!---------------- depends page END ----------------->
					
					<table width="500" class="formpanelbar">
						<tr>
							<td align="right" nowrap="">
								<html:submit tabindex="1001" styleClass="button"><bean:message key="common.submit" /></html:submit></td>
						</tr>
					</table>
				</html:form>
			</td>
			<!-- td id="oFrame" nowrap="" class="infoframe">&nbsp;</td -->
		</tr>
	</table>
	
	<iframe id="oDataGetter" style="display: none; "></iframe>
	
<script language="javascript">
function onDependTransItemSelect(row)
{
	oNewForm.oDependTrans.value = row.value;
	oNewForm.oDependTrans.fireEvent("onchange");
	return true;
}
function onDependTableItemSelect(row)
{
	oNewForm.oDependTable.value = row.value;
	oNewForm.oDependTable.fireEvent("onchange");
	return true;
}
function onTempItemSelect(row)
{
	var i;
	for (i = 0; i < oNewForm.oSchdTempList.options.length; ++i)
	{
		if (row.cells[0].innerText == oNewForm.oSchdTempList.options[i].text)
		{
			oNewForm.oSchdTempList.options[i].selected = true;
			break;
		}
	}
	oNewForm.oSchdTemp.value = row.cells[1].innerText;
	return true;
}
function oninit()
{
	initPropertyPageTable(oPropPagesTab, 500, 320);
	addPropertyPage(oPropPagesTab, ppGeneral, "<bean:message key="taskschedule.pp.general" />");
	addPropertyPage(oPropPagesTab, ppParams, "<bean:message key="taskschedule.pp.params" />");
	addPropertyPage(oPropPagesTab, ppUrl, "<bean:message key="taskschedule.pp.url" />");
	addPropertyPage(oPropPagesTab, ppDepends, "<bean:message key="taskschedule.pp.ppDepends" />");
	setPropertyPageActive(oPropPagesTab, 0);
}
function onSubmitCheck()
{
	if (5 != oNewForm.transid.value.length)
	{
		alert("<bean:message key="infotrans.err.invalidTransId" />");
		return false;
	}
	
	if (0 == getAllRows(oTempList).length)
	{
		if (0 < getAllRows(oDependTransList).length ||
			0 < getAllRows(oDependTableList).length)
		{
			alert("<bean:message key="reportSchd.err.dependenceNotNeed" />");
			return false;
		}
	}
	else
	{
		setParameters(oNewForm, "REPORT_SCHD_TEMPLATE", oTempList, "value");
		setParameters(oNewForm, "REPORT_SCHD_DEPENDENCE", oDependTransList, "value");
		setParameters(oNewForm, "REPORT_SCHD_DEPENDTABLE", oDependTableList, "value");
	}
	
	if (!oNewForm.oLoadPolicyList.disabled && "" != oNewForm.oLoadPolicyList.value)
	{
		if (!oNewForm.REPORT_SCHD_EXPORT[4].checked)
		{
			alert("<bean:message key="load.err.needExportCsv" />");
			return false;
		}
		if (0 == oNewForm.loadToTable.value.length)
		{
			alert("<bean:message key="load.err.needLoadToTable" />");
			return false;
		}
		
		setParameter(oNewForm, "REPORT_LOAD_POLICY", oNewForm.oLoadPolicyList.value);
		setParameter(oNewForm, "REPORT_LOAD_TABLE", oNewForm.loadToTable.value);
	}

	oNewForm.pageUrl.value += "?transid=" + oNewForm.transid.value;
	
	return true;
}

function onTaskClassChange(c)
{
	if ("git.etl.AutoMultiTableTransporter" == c.value)
		oTaskClassDesc.innerText = "<bean:message key="git.etl.AutoMultiTableTransporter.desc" />";
	else if ("git.bankview.sl.schedule.NullTask" == c.value)
		oTaskClassDesc.innerText = "<bean:message key="git.bankview.sl.schedule.NullTask.desc" />";
	else if ("git.bankview.bl.pump.SimpleSqlBatch" == c.value)
		oTaskClassDesc.innerText = "<bean:message key="git.bankview.bl.pump.SimpleSqlBatch.desc" />";
	else
		oTaskClassDesc.innerText = "<bean:message key="taskschedule.taskClassTip" />";
}
</script>

</body>
</html:html>

